iT邦幫忙

2024 iThome 鐵人賽

DAY 6
0
Kubernetes

從零到一: 使用Spring Boot、Kubernetes 和 Istio實現微服務架構系列 第 6

Day 6 使用Spring Boot、Kubernetes 和 Istio實現微服務架構 - Hello World

  • 分享至 

  • xImage
  •  

1-4 Hello World!

在開始之前,需要先知道幾種比較常用的Http Method

  1. GET:用來向特定來源請求資料
    譬如像資料庫拿取使用者帳號資料

  2. POST:新增資料
    在資料庫新增一筆資料,不管資料是否已經存在

  3. PUT: 如果資料已經存在就替換,沒有就新增

  4. PATCH:更新部份資料

  5. DELETE:刪除資料

@RestController
@SpringBootApplication(exclude = {SecurityAutoConfiguration.class})
public class SpringBootTutorialApplication {

	public static void main(String[] args) {
		SpringApplication.run(SpringBootTutorialApplication.class, args);

	}
	@GetMapping
	public String Hello() {
		return "Hello World";
	}
}

這是一個簡單的Hello World 的 Get請求,我們像Server請求了一個字串Hello,他會回給我們一個"Hello World"


上一篇
Day 5 使用Spring Boot、Kubernetes 和 Istio實現微服務架構 - pom.xml介紹
下一篇
Day 7 使用Spring Boot、Kubernetes 和 Istio實現微服務架構 - 建立Class跟Repository
系列文
從零到一: 使用Spring Boot、Kubernetes 和 Istio實現微服務架構25
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言